/*
 * Copyright (c) 2006, 2021, webrx.cn All rights reserved.
 *
 */
package cn.webrx.controller;

import cn.webrx.entity.Book;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.SpringBootVersion;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.time.LocalDate;
import java.time.LocalDateTime;
import java.util.HashMap;
import java.util.Map;

/**
 * <p>Project: sboot2021 - IndexController
 * <p>Powered by webrx On 2021-07-28 16:12:53
 * <p>Created by IntelliJ IDEA
 *
 * @author webrx [webrx@126.com]
 * @version 1.011
 * @since 16
 */
@RestController
public class IndexController {
    @Autowired
    private Book book;

    @GetMapping("/book")
    public Book book() {
        return book;
    }

    @RequestMapping("/")
    public String index() {
        return String.format("中文字符串效果 - Spring Boot Ver %s", SpringBootVersion.getVersion());
    }

    @GetMapping("/map")
    public Map<String, Object> map() {
        Map<String, Object> map = new HashMap<>();
        map.put("id", 10);
        map.put("name", "李四");
        map.put("money", 1000.128);
        map.put("birthday", LocalDate.now());
        map.put("regtime", LocalDateTime.now());
        return map;
    }
}
